RAD Studio VCL Reference
ContentsIndex
PreviousUpNext
AnsiStringBase::[] Operator (int)

Returns the character at a specified index in the string.

Pascal
operator [](const idx: Integer);
operator [](const idx: Integer);
C++
__fastcall char operator [](const int idx) const;
__fastcall char& operator [](const int idx);

This System::AnsiStringBase::[] returns the byte in the string at index value idx. The System::AnsiStringBase::[] assumes a base index of 1.

Note: If the string contains multi-byte characters, the System::AnsiStringBase::[] may return a byte value that represents the wrong character and/or a partial character. For character-level access, use the SubString method.
 

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!